@echo off
set rootPath=%1%
set nuspecName=%2%

set nuspecPath=%rootpath%%nuspecName%\NuGet\%nuspecName%.nuspec

echo Getting version from %nuspecPath%
"%~dp0CodeBlocks\bin\Debug\CodeBlocks.exe" "nuspecfilename=%nuspecPath%" > "%~dp0temp.txt"
set /p version= < %~dp0temp.txt
del %~dp0temp.txt
echo Version is %version%

echo packing %nuspecPath%
nuget pack "%nuspecPath%" -OutputDirectory "%rootpath%%nuspecName%\NuGet"

set nupkgPath=%rootpath%%nuspecName%\NuGet\%nuspecName%.%version%.nupkg
echo pushing %nupkgPath%
nuget push %nupkgPath%

del %nupkgPath%